import { createApp } from 'vue';
import App from './App.vue';
import router from './router';
import store from './store';
import * as ElementPlusIconsVue from '@element-plus/icons-vue';
import 'element-plus/dist/index.css';
import './assets/style/iconfont.less';
import ElementPlus from 'element-plus';
import zhCn from 'element-plus/es/locale/lang/zh-cn';
const app = createApp(App);
app.use(router);
app.use(store);
app.use(ElementPlus, {
  locale: zhCn,
});
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component);
}
// 注册全局自定义指令
app.directive('permission', {
  mounted(el, binding) {
    if (!store.getters.permissionMenus.includes(binding.value)) el.remove();
  },
});
app.mount('#app');
